package main

import "fmt"

func main() {
	fmt.Println(findRepeatDocument([]int{2, 3, 1, 0, 2, 5}))
}

func findRepeatDocument(documents []int) int {
	m := make(map[int]int)
	for _, v := range documents {
		if _, ok := m[v]; ok {
			return v
		} else {
			m[v] = 1
		}
	}
	return -1
}
